\(\int \frac {(g \cos (e+f x))^p}{(a+b \sin (e+f x)) (c+d \sin (e+f x))^2} \, dx\) [1562]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (warning: unable to verify)
   Maple [F]
   Fricas [F]
   Sympy [F(-1)]
   Maxima [F(-1)]
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 35, antiderivative size = 508 \[ \int \frac {(g \cos (e+f x))^p}{(a+b \sin (e+f x)) (c+d \sin (e+f x))^2} \, dx=-\frac {b g \operatorname {AppellF1}\left (1-p,\frac {1-p}{2},\frac {1-p}{2},2-p,\frac {a+b}{a+b \sin (e+f x)},\frac {a-b}{a+b \sin (e+f x)}\right ) (g \cos (e+f x))^{-1+p} \left (-\frac {b (1-\sin (e+f x))}{a+b \sin (e+f x)}\right )^{\frac {1-p}{2}} \left (\frac {b (1+\sin (e+f x))}{a+b \sin (e+f x)}\right )^{\frac {1-p}{2}}}{(b c-a d)^2 f (1-p)}+\frac {b g \operatorname {AppellF1}\left (1-p,\frac {1-p}{2},\frac {1-p}{2},2-p,\frac {c+d}{c+d \sin (e+f x)},\frac {c-d}{c+d \sin (e+f x)}\right ) (g \cos (e+f x))^{-1+p} \left (-\frac {d (1-\sin (e+f x))}{c+d \sin (e+f x)}\right )^{\frac {1-p}{2}} \left (\frac {d (1+\sin (e+f x))}{c+d \sin (e+f x)}\right )^{\frac {1-p}{2}}}{(b c-a d)^2 f (1-p)}+\frac {g \operatorname {AppellF1}\left (2-p,\frac {1-p}{2},\frac {1-p}{2},3-p,\frac {c+d}{c+d \sin (e+f x)},\frac {c-d}{c+d \sin (e+f x)}\right ) (g \cos (e+f x))^{-1+p} \left (-\frac {d (1-\sin (e+f x))}{c+d \sin (e+f x)}\right )^{\frac {1-p}{2}} \left (\frac {d (1+\sin (e+f x))}{c+d \sin (e+f x)}\right )^{\frac {1-p}{2}}}{(b c-a d) f (2-p) (c+d \sin (e+f x))} \]

[Out]

-b*g*AppellF1(1-p,1/2-1/2*p,1/2-1/2*p,2-p,(a-b)/(a+b*sin(f*x+e)),(a+b)/(a+b*sin(f*x+e)))*(g*cos(f*x+e))^(-1+p)
*(-b*(1-sin(f*x+e))/(a+b*sin(f*x+e)))^(1/2-1/2*p)*(b*(1+sin(f*x+e))/(a+b*sin(f*x+e)))^(1/2-1/2*p)/(-a*d+b*c)^2
/f/(1-p)+b*g*AppellF1(1-p,1/2-1/2*p,1/2-1/2*p,2-p,(c-d)/(c+d*sin(f*x+e)),(c+d)/(c+d*sin(f*x+e)))*(g*cos(f*x+e)
)^(-1+p)*(-d*(1-sin(f*x+e))/(c+d*sin(f*x+e)))^(1/2-1/2*p)*(d*(1+sin(f*x+e))/(c+d*sin(f*x+e)))^(1/2-1/2*p)/(-a*
d+b*c)^2/f/(1-p)+g*AppellF1(2-p,1/2-1/2*p,1/2-1/2*p,3-p,(c-d)/(c+d*sin(f*x+e)),(c+d)/(c+d*sin(f*x+e)))*(g*cos(
f*x+e))^(-1+p)*(-d*(1-sin(f*x+e))/(c+d*sin(f*x+e)))^(1/2-1/2*p)*(d*(1+sin(f*x+e))/(c+d*sin(f*x+e)))^(1/2-1/2*p
)/(-a*d+b*c)/f/(2-p)/(c+d*sin(f*x+e))

Rubi [A] (verified)

Time = 0.37 (sec) , antiderivative size = 508, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.057, Rules used = {3003, 2782} \[ \int \frac {(g \cos (e+f x))^p}{(a+b \sin (e+f x)) (c+d \sin (e+f x))^2} \, dx=-\frac {b g (g \cos (e+f x))^{p-1} \left (-\frac {b (1-\sin (e+f x))}{a+b \sin (e+f x)}\right )^{\frac {1-p}{2}} \left (\frac {b (\sin (e+f x)+1)}{a+b \sin (e+f x)}\right )^{\frac {1-p}{2}} \operatorname {AppellF1}\left (1-p,\frac {1-p}{2},\frac {1-p}{2},2-p,\frac {a+b}{a+b \sin (e+f x)},\frac {a-b}{a+b \sin (e+f x)}\right )}{f (1-p) (b c-a d)^2}+\frac {b g (g \cos (e+f x))^{p-1} \left (-\frac {d (1-\sin (e+f x))}{c+d \sin (e+f x)}\right )^{\frac {1-p}{2}} \left (\frac {d (\sin (e+f x)+1)}{c+d \sin (e+f x)}\right )^{\frac {1-p}{2}} \operatorname {AppellF1}\left (1-p,\frac {1-p}{2},\frac {1-p}{2},2-p,\frac {c+d}{c+d \sin (e+f x)},\frac {c-d}{c+d \sin (e+f x)}\right )}{f (1-p) (b c-a d)^2}+\frac {g (g \cos (e+f x))^{p-1} \left (-\frac {d (1-\sin (e+f x))}{c+d \sin (e+f x)}\right )^{\frac {1-p}{2}} \left (\frac {d (\sin (e+f x)+1)}{c+d \sin (e+f x)}\right )^{\frac {1-p}{2}} \operatorname {AppellF1}\left (2-p,\frac {1-p}{2},\frac {1-p}{2},3-p,\frac {c+d}{c+d \sin (e+f x)},\frac {c-d}{c+d \sin (e+f x)}\right )}{f (2-p) (b c-a d) (c+d \sin (e+f x))} \]

[In]

Int[(g*Cos[e + f*x])^p/((a + b*Sin[e + f*x])*(c + d*Sin[e + f*x])^2),x]

[Out]

-((b*g*AppellF1[1 - p, (1 - p)/2, (1 - p)/2, 2 - p, (a + b)/(a + b*Sin[e + f*x]), (a - b)/(a + b*Sin[e + f*x])
]*(g*Cos[e + f*x])^(-1 + p)*(-((b*(1 - Sin[e + f*x]))/(a + b*Sin[e + f*x])))^((1 - p)/2)*((b*(1 + Sin[e + f*x]
))/(a + b*Sin[e + f*x]))^((1 - p)/2))/((b*c - a*d)^2*f*(1 - p))) + (b*g*AppellF1[1 - p, (1 - p)/2, (1 - p)/2,
2 - p, (c + d)/(c + d*Sin[e + f*x]), (c - d)/(c + d*Sin[e + f*x])]*(g*Cos[e + f*x])^(-1 + p)*(-((d*(1 - Sin[e
+ f*x]))/(c + d*Sin[e + f*x])))^((1 - p)/2)*((d*(1 + Sin[e + f*x]))/(c + d*Sin[e + f*x]))^((1 - p)/2))/((b*c -
 a*d)^2*f*(1 - p)) + (g*AppellF1[2 - p, (1 - p)/2, (1 - p)/2, 3 - p, (c + d)/(c + d*Sin[e + f*x]), (c - d)/(c
+ d*Sin[e + f*x])]*(g*Cos[e + f*x])^(-1 + p)*(-((d*(1 - Sin[e + f*x]))/(c + d*Sin[e + f*x])))^((1 - p)/2)*((d*
(1 + Sin[e + f*x]))/(c + d*Sin[e + f*x]))^((1 - p)/2))/((b*c - a*d)*f*(2 - p)*(c + d*Sin[e + f*x]))

Rule 2782

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_), x_Symbol] :> Simp[g*(g*C
os[e + f*x])^(p - 1)*((a + b*Sin[e + f*x])^(m + 1)/(b*f*(m + p)*((-b)*((1 - Sin[e + f*x])/(a + b*Sin[e + f*x])
))^((p - 1)/2)*(b*((1 + Sin[e + f*x])/(a + b*Sin[e + f*x])))^((p - 1)/2)))*AppellF1[-p - m, (1 - p)/2, (1 - p)
/2, 1 - p - m, (a + b)/(a + b*Sin[e + f*x]), (a - b)/(a + b*Sin[e + f*x])], x] /; FreeQ[{a, b, e, f, g, p}, x]
 && NeQ[a^2 - b^2, 0] && ILtQ[m, 0] &&  !IGtQ[m + p + 1, 0]

Rule 3003

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*sin[(e_.) +
 (f_.)*(x_)])^(n_), x_Symbol] :> Int[ExpandTrig[(g*cos[e + f*x])^p*(a + b*sin[e + f*x])^m*(c + d*sin[e + f*x])
^n, x], x] /; FreeQ[{a, b, c, d, e, f, g, p}, x] && NeQ[a^2 - b^2, 0] && IntegersQ[2*m, 2*n]

Rubi steps \begin{align*} \text {integral}& = \int \left (\frac {b^2 (g \cos (e+f x))^p}{(b c-a d)^2 (a+b \sin (e+f x))}-\frac {d (g \cos (e+f x))^p}{(b c-a d) (c+d \sin (e+f x))^2}-\frac {b d (g \cos (e+f x))^p}{(b c-a d)^2 (c+d \sin (e+f x))}\right ) \, dx \\ & = \frac {b^2 \int \frac {(g \cos (e+f x))^p}{a+b \sin (e+f x)} \, dx}{(b c-a d)^2}-\frac {(b d) \int \frac {(g \cos (e+f x))^p}{c+d \sin (e+f x)} \, dx}{(b c-a d)^2}-\frac {d \int \frac {(g \cos (e+f x))^p}{(c+d \sin (e+f x))^2} \, dx}{b c-a d} \\ & = -\frac {b g \operatorname {AppellF1}\left (1-p,\frac {1-p}{2},\frac {1-p}{2},2-p,\frac {a+b}{a+b \sin (e+f x)},\frac {a-b}{a+b \sin (e+f x)}\right ) (g \cos (e+f x))^{-1+p} \left (-\frac {b (1-\sin (e+f x))}{a+b \sin (e+f x)}\right )^{\frac {1-p}{2}} \left (\frac {b (1+\sin (e+f x))}{a+b \sin (e+f x)}\right )^{\frac {1-p}{2}}}{(b c-a d)^2 f (1-p)}+\frac {b g \operatorname {AppellF1}\left (1-p,\frac {1-p}{2},\frac {1-p}{2},2-p,\frac {c+d}{c+d \sin (e+f x)},\frac {c-d}{c+d \sin (e+f x)}\right ) (g \cos (e+f x))^{-1+p} \left (-\frac {d (1-\sin (e+f x))}{c+d \sin (e+f x)}\right )^{\frac {1-p}{2}} \left (\frac {d (1+\sin (e+f x))}{c+d \sin (e+f x)}\right )^{\frac {1-p}{2}}}{(b c-a d)^2 f (1-p)}+\frac {g \operatorname {AppellF1}\left (2-p,\frac {1-p}{2},\frac {1-p}{2},3-p,\frac {c+d}{c+d \sin (e+f x)},\frac {c-d}{c+d \sin (e+f x)}\right ) (g \cos (e+f x))^{-1+p} \left (-\frac {d (1-\sin (e+f x))}{c+d \sin (e+f x)}\right )^{\frac {1-p}{2}} \left (\frac {d (1+\sin (e+f x))}{c+d \sin (e+f x)}\right )^{\frac {1-p}{2}}}{(b c-a d) f (2-p) (c+d \sin (e+f x))} \\ \end{align*}

Mathematica [B] (warning: unable to verify)

Leaf count is larger than twice the leaf count of optimal. \(12622\) vs. \(2(508)=1016\).

Time = 52.06 (sec) , antiderivative size = 12622, normalized size of antiderivative = 24.85 \[ \int \frac {(g \cos (e+f x))^p}{(a+b \sin (e+f x)) (c+d \sin (e+f x))^2} \, dx=\text {Result too large to show} \]

[In]

Integrate[(g*Cos[e + f*x])^p/((a + b*Sin[e + f*x])*(c + d*Sin[e + f*x])^2),x]

[Out]

Result too large to show

Maple [F]

\[\int \frac {\left (g \cos \left (f x +e \right )\right )^{p}}{\left (a +b \sin \left (f x +e \right )\right ) \left (c +d \sin \left (f x +e \right )\right )^{2}}d x\]

[In]

int((g*cos(f*x+e))^p/(a+b*sin(f*x+e))/(c+d*sin(f*x+e))^2,x)

[Out]

int((g*cos(f*x+e))^p/(a+b*sin(f*x+e))/(c+d*sin(f*x+e))^2,x)

Fricas [F]

\[ \int \frac {(g \cos (e+f x))^p}{(a+b \sin (e+f x)) (c+d \sin (e+f x))^2} \, dx=\int { \frac {\left (g \cos \left (f x + e\right )\right )^{p}}{{\left (b \sin \left (f x + e\right ) + a\right )} {\left (d \sin \left (f x + e\right ) + c\right )}^{2}} \,d x } \]

[In]

integrate((g*cos(f*x+e))^p/(a+b*sin(f*x+e))/(c+d*sin(f*x+e))^2,x, algorithm="fricas")

[Out]

integral((g*cos(f*x + e))^p/(a*c^2 + 2*b*c*d + a*d^2 - (2*b*c*d + a*d^2)*cos(f*x + e)^2 - (b*d^2*cos(f*x + e)^
2 - b*c^2 - 2*a*c*d - b*d^2)*sin(f*x + e)), x)

Sympy [F(-1)]

Timed out. \[ \int \frac {(g \cos (e+f x))^p}{(a+b \sin (e+f x)) (c+d \sin (e+f x))^2} \, dx=\text {Timed out} \]

[In]

integrate((g*cos(f*x+e))**p/(a+b*sin(f*x+e))/(c+d*sin(f*x+e))**2,x)

[Out]

Timed out

Maxima [F(-1)]

Timed out. \[ \int \frac {(g \cos (e+f x))^p}{(a+b \sin (e+f x)) (c+d \sin (e+f x))^2} \, dx=\text {Timed out} \]

[In]

integrate((g*cos(f*x+e))^p/(a+b*sin(f*x+e))/(c+d*sin(f*x+e))^2,x, algorithm="maxima")

[Out]

Timed out

Giac [F]

\[ \int \frac {(g \cos (e+f x))^p}{(a+b \sin (e+f x)) (c+d \sin (e+f x))^2} \, dx=\int { \frac {\left (g \cos \left (f x + e\right )\right )^{p}}{{\left (b \sin \left (f x + e\right ) + a\right )} {\left (d \sin \left (f x + e\right ) + c\right )}^{2}} \,d x } \]

[In]

integrate((g*cos(f*x+e))^p/(a+b*sin(f*x+e))/(c+d*sin(f*x+e))^2,x, algorithm="giac")

[Out]

integrate((g*cos(f*x + e))^p/((b*sin(f*x + e) + a)*(d*sin(f*x + e) + c)^2), x)

Mupad [F(-1)]

Timed out. \[ \int \frac {(g \cos (e+f x))^p}{(a+b \sin (e+f x)) (c+d \sin (e+f x))^2} \, dx=\int \frac {{\left (g\,\cos \left (e+f\,x\right )\right )}^p}{\left (a+b\,\sin \left (e+f\,x\right )\right )\,{\left (c+d\,\sin \left (e+f\,x\right )\right )}^2} \,d x \]

[In]

int((g*cos(e + f*x))^p/((a + b*sin(e + f*x))*(c + d*sin(e + f*x))^2),x)

[Out]

int((g*cos(e + f*x))^p/((a + b*sin(e + f*x))*(c + d*sin(e + f*x))^2), x)